local shengqian = fk.CreateSkill{
    name = "lingling__shengqian",
    tags = {Skill.Compulsory}
}
Fk:loadTranslationTable{
    ["lingling__shengqian"] = "省愆",
    [":lingling__shengqian"] = "锁定技，当你造成或受到伤害时，你获得并眀置造成伤害的牌，且你失去“省愆”牌前，这些同名牌你无法使用或被使用。",
    ["@@lingling__shengqian-inarea"] = "省愆",
}
local DIY = require "packages/diy_utility/diy_utility"
local spec = {
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(shengqian.name) and
        data.card and table.find(Card:getIdList(data.card),function(id) return player.room:getCardArea(id) == Card.Processing end)
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local cards = table.filter(Card:getIdList(data.card),function(id) return player.room:getCardArea(id) == Card.Processing end)
        room:obtainCard(player, cards, true, fk.ReasonJustMove, player, shengqian.name, "@@lingling__shengqian-inarea")
        DIY.showCards(player, cards)
    end,
}
shengqian:addEffect(fk.Damage, {
    anim_type = "offensive",
    can_trigger = spec.can_trigger,
    on_use = spec.on_use,
})
shengqian:addEffect(fk.Damaged, {
    anim_type = "masochism",
    can_trigger = spec.can_trigger,
    on_use = spec.on_use,
})
shengqian:addEffect("prohibit", {
    is_prohibited = function (self, from, to, card)
        return table.find(from:getCardIds("h"), function (cardID)
            local c = Fk:getCardById(cardID)
            return c:getMark("@@lingling__shengqian-inarea") > 0 and c.trueName == card.trueName
        end) or table.find(to:getCardIds("h"), function (cardID)
            local c = Fk:getCardById(cardID)
            return c:getMark("@@lingling__shengqian-inarea") > 0 and c.trueName == card.trueName
        end)
    end,
})

return shengqian